package com.mapbased.wfw;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2006</p>
 *
 * <p>Company: mapbased.com</p>
 *
 * @author chy_hs(Baily)
 * @version 1.0
 */
public class ActionHandler
    extends PageHandler
{
    public ActionHandler()
    {
        super();
    }

    /**
     *
     * @param context RenderContext
     * @return Object
     * @todo Implement this com.mapbased.wfw.PageHandler method
     */
    public Object dispatchAction(RenderContext context)
    {
        String actionMethod=context.getSureSingleParam(Constants.Page_Action);
        if(actionMethod.equals(""))
        {
            return this.defaultAction(context);
        }
        else if(actionMethod.equals("add"))
        {
            return this.addAction(context);
        }

        else if(actionMethod.equals("delete"))
        {
            return this.deleteAction(context);
        }
        else if(actionMethod.equals("update"))
        {
            return this.updateAction(context);
        }
        else if(actionMethod.equals("send"))
        {
            return this.sendAction(context);
        }

        else if(actionMethod.equals("info"))
        {
            return this.infoAction(context);
        }

        throw new java.lang.RuntimeException(
            "Action handler must use predefined handler:"
            + actionMethod);

    }

    public Object addAction(RenderContext rc)
    {
        return null;
    }

    public Object infoAction(RenderContext rc)
    {
        return null;
    }

    public Object deleteAction(RenderContext rc)
    {
        return null;
    }

    public Object updateAction(RenderContext rc)
    {
        return null;
    }

    public Object sendAction(RenderContext rc)
    {
        return null;
    }

    final protected Object refactionDispatch(String actionName,
                                             RenderContext context)
    {
        return null;
    }

}
